package com.efrei.uchat.tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.efrei.uchat.exception.UChatException;
import com.efrei.uchat.message.Message;
import com.efrei.uchat.message.Headers;

public class MessageTest {

	private Message messageTest, messageTextTest;
	
	private String messageText = "#0#TEXT#mon super text !#";
	
	@Before
	public void setUp() throws Exception {
		messageTest = new Message(Headers.TEXT, 0);
		messageTextTest = new Message(messageText);
	}

	@After
	public void tearDown() throws Exception {
		messageTest = null;
	}

	@Test
	public void testMessage() {
		assertNotNull(messageTest);
	}

	@Test
	public void testToString() {
		assertEquals(messageTest.toString(), "#0#TEXT#");
		assertEquals(messageTextTest.toString(), messageText);
	}

	@Test
	public void testMultiLines() throws UChatException {
		String txt = "#0#TEXT#hello#world#";
		messageTest = new Message(txt);
		assertEquals(messageTest.toString(), txt);
	}
}
